package com.stargate.bd.bean;

import java.sql.Date;

public class Sortie {

	/** CONSTANTES SQL */
	public static final String TABLE_NAME = "SORTIE";
	public static final String NUM_ACCES = "NumAcces";
	public static final String CODE_POINT_ACCES = "CodePointAcces";
	public static final String CODE_BATIMENT = "Code_Batiment";
	public static final String ETAT_SORTIE = "Etat_Sortie";
	public static final String DATE_SORTIE = "Date_Sortie";

	private int numAcces;
	private String codePointAcces;
	private String codeBatiment;
	private Etat etatSortie;
	private Date dateSortie;

	public Sortie(int numAcces, String codePointAcces, String codeBatiment,
			Etat etatSortie, Date dateSortie) {
		this.numAcces = numAcces;
		this.codePointAcces = codePointAcces;
		this.codeBatiment = codeBatiment;
		this.etatSortie = etatSortie;
		this.dateSortie = dateSortie == null ?
				FormatDate.dateSystemSQL() : dateSortie;
	}

	public int getNumAcces() {
		return numAcces;
	}

	public void setNumAcces(int numAcces) {
		this.numAcces = numAcces;
	}

	public String getCodePointAcces() {
		return codePointAcces;
	}

	public void setCodePointAcces(String codePointAcces) {
		this.codePointAcces = codePointAcces;
	}

	public String getCodeBatiment() {
		return codeBatiment;
	}

	public void setCodeBatiment(String codeBatiment) {
		this.codeBatiment = codeBatiment;
	}

	public Etat getEtatSortie() {
		return etatSortie;
	}

	public void setEtatSortie(Etat etatSortie) {
		this.etatSortie = etatSortie;
	}

	public Date getDateSortie() {
		return dateSortie;
	}

	public void setDateSortie(Date dateSortie) {
		this.dateSortie = dateSortie;
	}
	
	@Override
	public String toString() {
		return "Sortie[" + numAcces + ", " +
				codeBatiment + ", " +
				etatSortie.etat + ", " +
				dateSortie.toString() + "]";
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Sortie) {
			Sortie s = (Sortie) obj;
			return numAcces == s.numAcces 
					&& codeBatiment.equals(s.codeBatiment)
					&& codePointAcces.equals(s.codePointAcces);
		} else {
			return false;
		}
	}

}
